VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Begin VB.Form frmChList 
   BorderStyle     =   1  'Fixed Single
   ClientHeight    =   3900
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   8625
   Icon            =   "frmChList.frx":0000
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   3900
   ScaleWidth      =   8625
   StartUpPosition =   3  'Windows Default
   Begin MSComctlLib.StatusBar sBar 
      Align           =   2  'Align Bottom
      Height          =   255
      Left            =   0
      TabIndex        =   8
      Top             =   3645
      Width           =   8625
      _ExtentX        =   15214
      _ExtentY        =   450
      _Version        =   393216
      BeginProperty Panels {8E3867A5-8586-11D1-B16A-00C0F0283628} 
         NumPanels       =   3
         BeginProperty Panel1 {8E3867AB-8586-11D1-B16A-00C0F0283628} 
            Object.Width           =   3175
            MinWidth        =   3175
            Text            =   "Connected!"
            TextSave        =   "Connected!"
         EndProperty
         BeginProperty Panel2 {8E3867AB-8586-11D1-B16A-00C0F0283628} 
            Alignment       =   1
            AutoSize        =   1
            Object.Width           =   8758
            Text            =   "x channels formed"
            TextSave        =   "x channels formed"
         EndProperty
         BeginProperty Panel3 {8E3867AB-8586-11D1-B16A-00C0F0283628} 
            Alignment       =   2
            Object.Width           =   3175
            MinWidth        =   3175
            Text            =   "x members online"
            TextSave        =   "x members online"
         EndProperty
      EndProperty
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "Tahoma"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
   End
   Begin VB.ListBox lstUserList 
      BeginProperty Font 
         Name            =   "Tahoma"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   3180
      Left            =   5160
      Sorted          =   -1  'True
      TabIndex        =   3
      Top             =   360
      Width           =   3375
   End
   Begin VB.ListBox lstTopics 
      Height          =   450
      Left            =   0
      Sorted          =   -1  'True
      TabIndex        =   7
      Top             =   3120
      Visible         =   0   'False
      Width           =   855
   End
   Begin VB.CommandButton cmdCreate 
      BeginProperty Font 
         Name            =   "Tahoma"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   2520
      TabIndex        =   5
      Top             =   3120
      Width           =   1215
   End
   Begin VB.CommandButton cmdCancel 
      Cancel          =   -1  'True
      BeginProperty Font 
         Name            =   "Tahoma"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   1200
      TabIndex        =   6
      Top             =   3120
      Width           =   1215
   End
   Begin VB.CommandButton cmdJoin 
      Default         =   -1  'True
      BeginProperty Font 
         Name            =   "Tahoma"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   3840
      TabIndex        =   4
      Top             =   3120
      Width           =   1215
   End
   Begin VB.ListBox lstChannels 
      BeginProperty Font 
         Name            =   "Tahoma"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   2595
      Left            =   120
      Sorted          =   -1  'True
      TabIndex        =   1
      Top             =   360
      Width           =   4935
   End
   Begin VB.Label lblUsers 
      BeginProperty Font 
         Name            =   "Tahoma"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   255
      Left            =   5160
      TabIndex        =   2
      Top             =   120
      Width           =   3135
   End
   Begin VB.Label Label1 
      BeginProperty Font 
         Name            =   "Tahoma"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   255
      Left            =   120
      TabIndex        =   0
      Top             =   120
      Width           =   5295
   End
End
Attribute VB_Name = "frmChList"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Dim WithEvents IRCLink As clsModIRC
Attribute IRCLink.VB_VarHelpID = -1

Private Sub cmdCancel_Click()
Unload Me
End Sub

Private Sub cmdCreate_Click()
frmCreateChan.Show
Me.Hide
Unload Me
End Sub

Private Sub cmdJoin_Click()
frmMain.SpeechInterface.StopSpeech
If lstChannels.ListIndex > -1 Then
  modAC.currentChannel = GetWord(lstChannels.List(lstChannels.ListIndex), 1)
  Unload Me
End If
End Sub

Private Sub Form_KeyUp(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyF2 And Shift = 0 Then

On Error Resume Next
Select Case ActiveControl.Name
  Case "lstChannels"
    frmMain.SpeechInterface.Say lang.Help(0), True
  Case "txtUserList"
    frmMain.SpeechInterface.Say lang.Help(1), True
  Case "cmdJoin"
    frmMain.SpeechInterface.Say lang.Help(2), True
  Case "cmdCreate"
    frmMain.SpeechInterface.Say lang.Help(3), True
  Case "cmdCancel"
    frmMain.SpeechInterface.Say lang.Help(4), True
End Select
On Error GoTo 0

End If

End Sub

Private Sub Form_Load()
Me.Caption = lang.Messages(12)
Label1.Caption = lang.Messages(13)
lblUsers.Caption = lang.Messages(14)
cmdJoin.Caption = lang.Buttons(7)
cmdCreate.Caption = lang.Buttons(8)
cmdCancel.Caption = lang.Buttons(9)

Set IRCLink = frmMain.IRCInterface

lstChannels.Clear
lstUserList.Clear
lstChannels.AddItem lang.Messages(15)
lstUserList.AddItem lang.Messages(15)

IRCLink.RequestList

End Sub

Private Sub Form_Unload(Cancel As Integer)
  Set IRCLink = Nothing
End Sub

Private Sub IRCLink_ChannelList(ChanList() As String)
Dim c As Long
Dim ChannelListString As String
Dim now1 As Long

lstChannels.Clear

For c = 1 To UBound(ChanList)

  ChannelListString = GetWord(ChanList(c), 1) + _
    " " + GetWord(ChanList(c), 2) + " members"
  lstChannels.AddItem ChannelListString
  
  ChannelListString = GetWord(ChanList(c), 1) + " "
    If Left(GetFromWord(ChanList(c), 3), 1) = "[" Then
      ChannelListString = ChannelListString + GetFromWord(ChanList(c), 4)
      Else
      ChannelListString = ChannelListString + GetFromWord(ChanList(c), 3)
    End If
  lstTopics.AddItem ChannelListString
  
Next

sBar.Panels(2).Text = Trim(Str(lstChannels.ListCount)) + " channels formed"

'wait one second
now1 = Now + (1 / 86400)
Do Until now1 > Now: DoEvents: Loop
now1 = vbNull

IRCLink.RequestWho

End Sub

Private Sub IRCLink_WhoList(WhoList() As String)
Dim c As Long, ig As Long
Dim ChannelListString As String

lstUserList.Clear

For c = 1 To UBound(WhoList)

  ChannelListString = GetWord(WhoList(c), 5) + _
    " " + GetWord(WhoList(c), 1)
  
    If InStr(GetWord(ChannelListString, 1), "Serv") > 0 Then GoTo GoNext
    If Right(GetWord(ChannelListString, 1), 3) = "Bot" Then GoTo GoNext
    If Left(GetWord(ChannelListString, 1), 5) = "Guest" Then GoTo GoNext
    For ig = 1 To WordCount(Settings.KnownIgnores)
      If LCase(GetWord(Settings.KnownIgnores, ig)) = LCase(GetWord(ChannelListString, 1)) Then GoTo GoNext
    Next
    lstUserList.AddItem ChannelListString
 
GoNext:
Next

lblUsers.Caption = "Online Users (" + Trim(Str(lstUserList.ListCount)) + " users online)"
sBar.Panels(3).Text = Trim(Str(lstUserList.ListCount)) + " users online"

End Sub

Private Sub lstChannels_DblClick()
cmdJoin_Click
End Sub

Private Sub lstChannels_KeyUp(KeyCode As Integer, Shift As Integer)
Dim thechannel As String

If KeyCode = vbKeyF2 And lstChannels.List(lstChannels.ListIndex) <> "" Then
  thechannel = GetWord(lstChannels.List(lstChannels.ListIndex), 1)
  frmMain.SpeechInterface.StopSpeech
  If GetFromWord(lstTopics.List(lstChannels.ListIndex), 2) = "" Then
        MsgBox SPrintF(lang.Messages(17), " ", thechannel), vbOKOnly + vbInformation, SPrintF(lang.Messages(16), " ", thechannel)
  Else
  MsgBox SPrintF(lang.Messages(18), thechannel, StripCodes(GetFromWord(lstTopics.List(lstChannels.ListIndex), 2))), vbOKOnly + vbInformation, SPrintF(lang.Messages(16), " ", thechannel)
  End If
  End If
End Sub

Private Sub lstUserList_KeyUp(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyF3 And Shift = vbShiftMask And lstUserList.List(lstUserList.ListIndex) <> "" Then
  frmWhois.DoWhois GetWord(lstUserList.List(lstUserList.ListIndex), 1)
End If
End Sub
